<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<link rel="stylesheet" media="screen" type="text/css" href="__THEMES__/style/layout.css" />
		<script type="text/javascript" src="__JS__/jQuery/jquery.js"></script>
		<include file="Public:js_artDialog" />
		<include file="Public:js_editor" />
		<script type="text/javascript">
			var editor;
			KindEditor.ready(function(K){
				editor = K.create("#content",{
					uploadJson:'{:U("uploadfile/uploadeditor")}',
					allowFileManager:true,
					width : "100%",
					fileManagerJson:'{:U("filemanage/viewlist")}',
					sessionid : '<?php echo $_COOKIE["PHPSESSID"];?>',
					afterUpload:function(data){
						if($("#content_attachment").val() == ""){
			       			$("#content_attachment").attr("value",data);
			       		}else{
			       			$("#content_attachment").attr("value",$("#content_attachment").val()+"|"+data);
			       		}
					}
				});
			});
			$(function(){
				//载入省份
                $.get("{:U('Location/index',array('id'=>0,'provinces'=>$vo['Provinces'],'type'=>'Provinces'))}", function(data){ $('.Provinces').html(data); });
                $.get("{:U('Location/index',array('id'=>$vo['Provinces'],'provinces'=>$vo['City'],'type'=>'City'))}", function(n){ $('.City').html(n); });
				$.get("{:U('Location/index',array('id'=>$vo['City'],'provinces'=>$vo['Region'],'type'=>'Region'))}", function(n){ $('.Region').html(n); });
					
				//按需加载城市列表
		        $('.Provinces').change(function() {
		        	var id = $(this).val();
					var dom_name = this.id;
				    if ( $('#City_'+id).html() != null ){  //判断数据是否存在
					    $('#'+dom_name+'-id_City').html($('#City_'+id).html());  //存在直接调用
					}else{
				        $.get("__APP__/Location/index/type/City/id/" + id,  /*不存在发送请求*/ function(data){
				            $('#'+dom_name+'-id_City').html(data);
							$('#Location_data').append('<select id="City_'+id+'">'+data+'</select>');  //将返回的数据写入页面,重复调用,减小请求.
						});
					}
				});
				
				//按需加载地区列表
		        $('.City').change(function() {
				    var id = $(this).val();
					var dom_name = this.id;
				    if ( $('#Region_'+id).html() != null ){
					    $('#'+dom_name+'-id_Region').html($('#Region_'+id).html());
					}else{
				        $.get("__APP__/Location/index/type/Region/id/" + id, function(data){
				            $('#'+dom_name+'-id_Region').html(data);
							$('#Location_data').append('<select id="Region_'+id+'">'+data+'</select>');
						});
					}
				});
		
				//为每个select 创建唯-ID,以便重复调用
				var _select    = new Array();
				    _select[0] = '.Provinces';
				    _select[1] = '.City';
				    _select[2] = '.Region';
					
				var _number, _name;
				
				for ( var i = 0; i < 3; i++ ){
				    _number = $(_select[i]).length;
					for ( var i2 = 0; i2 < _number; i2++ ){
						
						switch( _select[i] ){
							case '.Provinces' :
								$( $( _select[i] ).get( i2 ) ).attr('id','Ajax_dom_select_id_Provinces_' + i2 ); //ID名字尽量长一些,以免同页面的ID相同
								break;
							case '.City' :
								$( $( _select[i] ).get( i2 ) ).attr('id','Ajax_dom_select_id_Provinces_' + i2 + '-id_City');
								break;
							case '.Region' :
								$( $( _select[i] ).get( i2 ) ).attr('id','Ajax_dom_select_id_Provinces_' + i2 + '-id_City-id_Region');
								break;
						}
						
					}
				}
				
			});
		</script>
	</head>
	<body>
		<include file="Public:position" />
		
		<form method="post" action="__URL__/update">
            <input type="hidden" name="id" value="{$vo.id}" />
            <input type="hidden" name="content_attachment" id="content_attachment" value="{$vo.content_attachment}" />
            <table width="100%" class="form_table">
            	<tr>
            		<td width="90"></td>
            		<td></td>
            	</tr>
                <tr>
                    <td align="right" class="left_text">职位名称：</td>
                    <td align="left"><input type="text" class="input_text w480" name="name" value="{$vo.name}"></td>
                </tr>
                <tr>
                    <td align="right" class="left_text">语言：</td>
                    <td align="left">
                        <input type="radio" name="lang" value="zh-cn"<eq name="vo.lang" value="zh-cn" > checked="checked"</eq> /> 中文 &nbsp; 
                        <input type="radio" name="lang" value="en-us"<eq name="vo.lang" value="en-us" > checked="checked"</eq> /> English
                    </td>
                </tr>
                <tr>
                    <td align="right" class="left_text">职位类型：</td>
                    <td align="left">
                        <input type="radio" name="type" value="1"<eq name="vo.type" value="1" > checked="checked"</eq> /> 普通职位 &nbsp; 
                        <input type="radio" name="type" value="2"<eq name="vo.type" value="2" > checked="checked"</eq> /> 猎头职位
                    </td>
                </tr>
                <tr>
                    <td align="right" class="left_text">地点：</td>
                    <td align="left">
                        <select class="Provinces input_text" name="Provinces" style="width:auto;">
                            <option selected="selected" value="">载入中...</option>
                        </select> *省份 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                        
                        <select class="City input_text" name="City" style="width:auto;">
                            <option selected="selected" value="">请选择</option>
                        </select> *城市  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                        
                        <select class="Region input_text" name="Region" style="width:auto;">
                            <option selected="selected" value="">请选择</option>
                        </select> *地区
                        
                    </td>
                </tr>
                <tr>
                    <td align="right" class="left_text">状态：</td>
                    <td align="left">
                        <input type="radio" name="status" value="1"<eq name="vo.status" value="1" > checked="checked"</eq> /> 启用 &nbsp; 
                        <input type="radio" name="status" value="0"<eq name="vo.status" value="0" > checked="checked"</eq> /> 禁用 &nbsp; 
                    </td>
                </tr>
                <tr>
                    <td align="right" class="left_text">职位描述：</td>
                    <td align="left"><textarea name="content" id="content" style="width: 90%; height:260px;">{$vo.content}</textarea></td>
                </tr>
                <tr>
                    <td align="right" class="left_text"></td>
                    <td align="left"><input type="submit" class="submit" value="提交表单" /></td>
                </tr>
                <tr>
            		<td></td>
            		<td></td>
            	</tr>
            </table>
        </form>
	</body>
</html>